<?php

namespace common\models;

use Yii;
use yii\behaviors\TimestampBehavior;
use yii\db\ActiveRecord;

/**
 * This is the model class for table "file".
 *
 * @property integer $file_id
 * @property string $file_path
 * @property integer $file_status
 * @property integer $file_type
 * @property integer $created_at
 * @property integer $updated_at
 */
class File extends \yii\db\ActiveRecord
{
    /**
     * @var $imageFile
     */
    public $imageFile;
    
    
    /** 轮播图 */
    const FLASH_TYPE = 1;
    /** 商品缩略图 */
    const GOODS_TYPE = 2;
    const ARTICLE_TYPE = 3;
    const WECHAT_TYPE = 4;
    
    public function behaviors()
    {
        return [
            [
                'class' => TimestampBehavior::className(),
                'attributes' => [
                    ActiveRecord::EVENT_BEFORE_INSERT => ['created_at', 'updated_at'],
                    ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at'],
                ]
            ]
        ];
    }
    
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'file';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['file_status', 'file_type', 'created_at', 'updated_at'], 'integer'],
            [['file_path'], 'string', 'max' => 255],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'file_id' => 'File ID',
            'file_path' => 'File Path',
            'file_status' => 'File Status',
            'created_at' => 'Created At',
            'updated_at' => 'Updated At',
        ];
    }
    
    
}
